package sprintServer.start;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;

import sprintServer.doing.thread.SprintServerThread;




public class SprintServer {
	
	private ArrayList<SprintServerThread> sstList;
	private Socket socket;
	
	public ArrayList<SprintServerThread> getSstList() {
		return sstList;
	}

	public Socket getSocket() {
		return socket;
	}


	public SprintServer() throws IOException{
		sstList = new ArrayList<SprintServerThread>();
		ServerSocket serverSocket = new ServerSocket(3123);
		SprintServerThread sst = null;
		boolean isStop = false;
		while(!isStop){
			System.out.println("Server is Ready");
			socket = serverSocket.accept();
		
			System.out.println("Client accept");
			sst = new SprintServerThread(this);
			sstList.add(sst);
			Thread t = new Thread(sst);
			t.start();
			System.out.println("스레드 갯수 = "+Thread.activeCount());
		}
		serverSocket.close();
	}

	public static void main(String[] args)throws IOException {
		// TODO Auto-generated method stub
		new SprintServer();
	}

}
